<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use App\Http\Controllers\TimedTasks;
class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */


    protected $commands = [
        \App\Console\Commands\ESInit::class
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        //定时任务
        $schedule->call(function () {
             $timetasks = new TimedTasks();
             //十分钟关闭外卖订单
             //$timetasks->cancelOrders();
             //12小时确定外卖订单
             $timetasks->orderOrders();
             //30分钟关闭超时未付款预定订单
             $timetasks->closeOrders();
        })->everyMinute();

        $schedule->command('inspire')->everyTenMinutes();

        $schedule->command('route:list')->dailyAt('02:00');


    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}
